<%@ page contentType="text/html; charset=UTF-8" %> 
<%@ page import="com.peixunp.bean.*"%>
<%@ page import="finaler.util.PageList" %>
<%@ page import="finaler.util.PageUtil" %>
<%@ page import="com.peixunp.util.Constants" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%
	Organizations school = (Organizations)request.getAttribute("school");
	Place city = (Place)request.getAttribute("city");
	PageList remarkList = (PageList)request.getAttribute("remarkList");
	List<Information> informationList = (ArrayList)request.getAttribute("informationList");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><%=school==null?"":school.getOrgname()%>怎么样?好不好?<%=school==null?"":school.getOrgname()%>的评价--培训学校评价网</title>
<meta name="keywords" content="培训学校评价网,培训中心评价网,,培训机构评价网,培训学校评价,培训中心评价,培训机构评价">
<meta name="description" content="培训学校评价网,通过学员客观公平的评价,为选择培训学校提供更多参考依据。">
</head>


<script>
	function setRemark(s){
		$("input[name=coin]:eq(2)").attr("checked",'checked');
		$("#rmcontent").val(s);
	}
	function checkRemarkForm(){
		if($("#rmcontent").val()==""|| $("#rmcontent").length>1000){
			alert("评论内容不能为空,也不能超过1000字哦!");
			$("#recontent").focus();
			return false;
		}
	}
	function want(orgId){
		$("#wantButton").attr("disabled",true);
		$.ajax({
			type: "POST",
			url: "<%=Constants.URL %>/school/want_"+orgId,
			data: {},
		    success: function(rst){
		    	if(rst=='ok'){
					$("#wantSpan").text(parseInt($("#wantSpan").text())+1);
					$("#wantButton").val("已报名!");
		    	}
			}
		});
	}
	function once(orgId){
		$("#onceButton").attr("disabled",true);
		$.ajax({
			type: "POST",
			url: "<%=Constants.URL %>/school/once_"+orgId,
			data: {},
		    success: function(rst){
		    	if(rst=='ok'){
					$("#onceSpan").text( parseInt($("#onceSpan").text())+1);
					$("#onceButton").val("已提交!");
		    	}
			}
		});
	}
	function showInformationInput(){
		$("#ifTable").css("display","block"); 
	}
	function hideInformationInput(){
		$("#ifTable").css("display","none"); 
	}
	function checkInformationForm(orgId){
		if($("#ifcontent").val()==""|| $("#ifcontent").length>1000){
			alert("培训信息内容不能为空,也不能超过1000字哦!");
			$("#ifcontent").focus();
			return false;
		}
		$.ajax({
			type: "POST",
			url: "<%=Constants.URL %>/school/addInformation_"+orgId,
			data: {"ifcontent":$("#ifcontent").val()},
		    success: function(rst){
		    	if(rst=='ok'){
					alert("已成功发布,请等待审核!");
					$("#ifcontent").val("");
					$("#ifTable").css("display","none"); 
		    	}
			}
		});
	}
</script>
<jsp:include page="/commonImport.jsp"/> 

<body>
	<div class="content">
		<jsp:include page="/top.jsp"/> 
		
		<div class="left">
		
			<jsp:include page="/WEB-INF/jsp/ad/left10Ad.jsp"/> 
			
			<h3><strong>学校名称: </strong><font color="yellow" size="4"><%=school==null?"":school.getOrgname()%></font> &nbsp; &nbsp;
				<strong>简称: </strong><font color="yellow" size="4"><%=school==null?"":school.getOrgshortname()%></font>&nbsp; &nbsp;
				<strong>总评分: <font  size="4" color="yellow"><%=request.getAttribute("avgFen")%></font></strong>
			</h3>
			
			<div class="left_box">
					<table width="100%" border="0" cellspacing="1" cellpadding="0" class="defaultFont">
			              <tr> 
			                <td>
				                <img src="<%=Constants.URL %>/images/arrow_red.gif" width="4" height="13"> 地址：<%=school==null?"":school.getOrgaddr()%>　浏览数: <%=school==null?"":school.getHit()%><br/>
				                <img src="<%=Constants.URL %>/images/arrow_red.gif" width="4" height="13"> 电话：<%=school==null?"":school.getOrgtel()%>　建校年份：<%=school==null?"":school.getWhencreate()%>　</a><br>
				                <img src="<%=Constants.URL %>/images/arrow_red.gif" width="4" height="13"> 培训项目：<%=school==null?"":school.getOrgcontent()%><br>
			               </td>
			              </tr>
		              <tr> 
		                <td align="right">
		                		<img src="<%=Constants.URL %>/images/arrow_red.gif" width="4" height="13"> <a href="<%=Constants.URL %>/us/contact.html">我是该校老师,我要修改学校信息</a>
						</td>
		              </tr>
				    </table>
			</div>
		
			<h3><%=school==null?"":school.getOrgname()%>的培训信息: </h3>
			<div class="left_box">
					<table width="100%" border="0" cellspacing="6" cellpadding="0" class="defaultFont">
					<!-- loop -->
						<%if(informationList!=null && informationList.size()>0){
						for(Information information : informationList ){
						%>
						<div>
							<div class="defaultFont">
							<img src="<%=Constants.URL %>/images/arrow_red.gif" width="4" height="13">发布时间：<%=information.getCreatetime() %><br/>
							<img src="<%=Constants.URL %>/images/arrow_red.gif" width="4" height="13">培训内容:<%=information.getIfcontent() %>
							</div>
						</div>
						<hr/>
						<%
						}
						}else{
							out.print("<center class=\"defaultFont\">暂无培训信息!</center>");
						}%>
		            <!-- endloop -->
		              <tr> 
			          		<td align="right">
			                		<img src="<%=Constants.URL %>/images/arrow_red.gif" width="4" height="13"> <a href="javascript:showInformationInput()">我是该校老师,我要发布培训信息</a>
			          		</td>
		              </tr>
			  		</table>
					<form action="###" method="post" >
						<input type="hidden" id="orgId" name="orgId" value="<%=school==null?"":school.getId()%>"/>
				  		<span id="#ifSpan"></span>
				  		<table id="ifTable" name="ifTable" width="100%" border="0" cellspacing="1" cellpadding="0" class="defaultFont" style="display:none">
				              <tr> 
				                <td colspan="2">
					                <img src="<%=Constants.URL %>/images/arrow_red.gif" width="4" height="13"> 培训信息内容：<br>
					                <textarea id="ifcontent"  name="ifcontent"  maxlength="1000" style="width:655px;height:100px" placeholder="可以发布最新培训资讯...(1000字以内)"></textarea><br/>
					                </td>
				                </tr>
				              <tr>
				                <td align="right">
					                <input type="button" value="<<隐藏" class="submit" onclick="javascript:hideInformationInput()"/>
					                <input type="button" value="发布>>" class="submit" onclick="checkInformationForm('<%=school==null?"":school.getId()%>')"/>
				               </td>
				              </tr>
					    </table>
				    </form>
			</div>
			
			<h3>对<%=school==null?"":school.getOrgname()%>的评论:</h3>
			<div class="left_box">
				<!-- loop -->
				<%
				if(remarkList!=null && remarkList.getList().size()>0){
					for(int i=0;i< remarkList.getList().size();i++){
						Remark remark = (Remark) remarkList.getList().get(i);
					%>
					<div>
						<div class="defaultFont">
							<img src="<%=Constants.URL %>/images/arrow_red.gif" width="4" height="13"> 评论人:<%=remark.getCreateuser()%>&nbsp;&nbsp;
							<img src="<%=Constants.URL %>/images/arrow_red.gif" width="4" height="13"> 评论时间:<%=remark.getCreatetime()%>&nbsp;&nbsp;
							<img src="<%=Constants.URL %>/images/arrow_red.gif" width="4" height="13"> 评分:<b><%=remark.getCoin()%></b>分<br/>
							<img src="<%=Constants.URL %>/images/arrow_red.gif" width="4" height="13"> 评论内容:<b><%=remark.getRmcontent()%></b>
						</div>
					</div>
					<hr/>
					<%
					}
				}else{
					out.print("<center class=\"defaultFont\">暂无评论!快抢沙发吧...</center>");
				}%>
				<!--end loop -->
			</div>
			<div class="baseRight">
				<%if(remarkList!=null && remarkList.getList().size()>0){%>
					<%=PageUtil.getCurrPage(remarkList)%>&nbsp;
					<%=PageUtil.getRecord(remarkList)%>&nbsp;
					<%=PageUtil.getSinglePaginator(remarkList)%>
				<%} %>
			</div>
			<h3>发表你对<%=school==null?"":school.getOrgname()%>的看法:</h3>
			<div class="left_box">
				<form action="<%=Constants.URL %>/school/remark" method="post" onsubmit="return checkRemarkForm()">
					<input type="hidden" id="cityId" name="cityId" value="<%=city==null?"":city.getId()%>"/>
					<input type="hidden" id="orgId" name="orgId" value="<%=school==null?"":school.getId()%>"/>
					<table width="100%" border="0" cellspacing="1" cellpadding="0" class="defaultFont">
			              <tr> 
			                <td colspan="2">
				                <img src="<%=Constants.URL %>/images/arrow_red.gif" width="4" height="13"> 分数：<input type="radio" id="coin" name="coin" value="0"/>差劲(0分)&nbsp;&nbsp;<input type="radio" id="coin" name="coin" value="30"/>不好(30分)&nbsp;&nbsp;<input type="radio" id="coin" name="coin" value="60" checked/>一般(60分)&nbsp;&nbsp;<input type="radio" id="coin" name="coin" value="80"/>挺好(80分)&nbsp;&nbsp;<input type="radio" id="coin" name="coin" value="100"/>很好(100分)<br/>
				                <img src="<%=Constants.URL %>/images/arrow_red.gif" width="4" height="13"> 内容：<br>
				                <textarea id="rmcontent"  name="rmcontent"  maxlength="1000" style="width:655px;height:100px" placeholder="请根据实际情况客观评价,不得粗言秽语...(1000字以内)"></textarea><br/>
				                </td>
			                </tr>
			              <tr>
			                <Td><img src="<%=Constants.URL %>/images/arrow_red.gif" width="4" height="13"> 你的名字：<input type="input" id="createuser" name="createuser" onblur="this.value=this.value===''?'<%=request.getRemoteAddr() %>':this.value" value="<%=request.getRemoteAddr() %>" maxlength="20"/>
			                </Td>
			                <td align="right">
				                <input type="submit" value="评论" class="submit" />
			               </td>
			              </tr>
				    </table>
			    </form>
			    <hr/>
				<font class="defaultFont"><b>懒打字模板:</b> <br/>
				<a href="javascript:setRemark('嗯。在那学过东西。老师水平还可以。不过关键还是得靠自己。')">[60分] 嗯。在那学过东西。老师水平还可以。不过关键还是得靠自己。</a><br/>
				<a href="javascript:setRemark('我觉得还是不错的。至少还是学到了东西。')">[60分] 我觉得还是不错的。至少还是学到了东西。</a><br/>
				<a href="javascript:setRemark('一般般吧。反正也就那样了。')">[60分] 一般般吧。反正也就那样了。</a>
				</font>
			</div>
			
		</div>
		
		<div class="right">
			<h3>想就读<%=school==null?"":school.getOrgname()%>:</h3>
			<div class="right_articles">
				<p>
					<img src="<%=Constants.URL %>/images/sun.png"  alt="Image" title="Image" class="image" />
					有<font color="red" size="4"><b><span id="wantSpan" name="wantSpan"><%=school==null?"":school.getWant()%></span></b></font>位网友准备报名就读该学校<br/><br/>
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" id="wantButton" name="wantButton" onclick="want('<%=school==null?"":school.getId()%>')" value="我也准备报名该学校" />
				</p>
			</div>
			<h3>曾就读<%=school==null?"":school.getOrgname()%>:</h3>
			<div class="right_articles">
				<p>
					<img src="<%=Constants.URL %>/images/sun.png"  alt="Image" title="Image" class="image" />
					有<font color="red" size="4"><b><span id="onceSpan" name="onceSpan"><%=school==null?"":school.getOnce()%></span></b></font>位网友表示曾就读该校<br/><br/>
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button"  id="onceButton" name="onceButton" onclick="once('<%=school==null?"":school.getId()%>')"  value="我也曾经就读过该校" />
				</p>
			</div>
			<jsp:include page="/WEB-INF/jsp/ad/right10Ad.jsp"/> 
		</div>
		
		<jsp:include page="/foot.jsp"/> 
	</div>
</body>
</html>